package com.group5.onlinegame.handler;


import com.group5.onlinegame.entity.ProductType;
import com.group5.onlinegame.service.IProductTypeService;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/")
public class ProductTypeHandler {

    @Resource
    private IProductTypeService iProductTypeService;

    @RequestMapping("productType")
    @RequiresRoles("good")
    public ModelAndView getProductTypeList(){
        ModelAndView modelAndView = new ModelAndView("productType");
        List<ProductType> ptList = iProductTypeService.getProductTypeList();
        modelAndView.addObject("ptList",ptList);
        return modelAndView;
    }
}
